package list;

import java.util.LinkedList;

public class LinkedListDemo {
	public static void main(String[] args) {
		//ArrayList是基于Object数组，LinkedList是基于双向链表
		LinkedList<String> list = new LinkedList<>();	
		list.add("abc");
		list.add("def");
		list.add("wdfa");
		list.add("rqzs");
		list.add("fsag");
		list.add("wdfa");
		System.out.println(list.size());
		System.out.println(list.get(1));
		System.out.println(list.contains("def"));
		System.out.println(list.indexOf("rqzs"));
		System.out.println(list.remove(0));
		System.out.println(list.remove("def"));
		System.out.println(list);
		System.out.println(list.subList(0, 3));
		System.out.println(list.isEmpty());
		System.out.println(list.set(0, "fed"));
		System.out.println(list);
		list.clear();
		System.out.println(list);
	}
}
